<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>社交活动平台 - 设置</title>
    <style>
        /* 重置样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }

        /* 容器样式 */
        .container {
            max-width: 480px;
            margin: 0 auto;
            background-color: #fff;
            min-height: 100vh;
        }

        /* 头部导航 */
        .header {
            position: sticky;
            top: 0;
            background-color: white;
            padding: 16px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            z-index: 100;
        }

        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .back-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #333;
        }

        .header-title {
            font-size: 18px;
            font-weight: bold;
            flex-grow: 1;
            text-align: center;
        }

        .action-btn {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #333;
        }

        /* 用户信息区域 */
        .user-info-section {
            padding: 24px 16px;
            text-align: center;
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
            position: relative;
        }

        .user-avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 40px;
            margin: 0 auto 16px;
            border: 3px solid rgba(255, 255, 255, 0.3);
        }

        .user-name {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 4px;
        }

        .user-id {
            font-size: 14px;
            opacity: 0.9;
        }

        /* 设置菜单 */
        .settings-menu {
            padding: 16px 0;
        }

        /* 设置项 */
        .setting-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 16px 20px;
            border-bottom: 1px solid #eee;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .setting-item:hover {
            background-color: #f9f9f9;
        }

        .setting-icon {
            width: 24px;
            height: 24px;
            margin-right: 16px;
            color: #ff6b35;
        }

        .setting-content {
            flex-grow: 1;
        }

        .setting-title {
            font-size: 16px;
            font-weight: 500;
            margin-bottom: 4px;
        }

        .setting-description {
            font-size: 13px;
            color: #999;
        }

        .setting-value {
            font-size: 14px;
            color: #666;
            margin-left: 12px;
        }

        .arrow-icon {
            color: #ccc;
            font-size: 18px;
        }

        /* 设置项开关 */
        .switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 28px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 28px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .slider {
            background-color: #ff6b35;
        }

        input:checked + .slider:before {
            transform: translateX(22px);
        }

        /* 分组标题 */
        .section-title {
            padding: 16px 20px;
            font-size: 14px;
            color: #999;
            text-transform: uppercase;
            letter-spacing: 1px;
            border-bottom: 1px solid #eee;
        }

        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: white;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: space-around;
            padding: 12px 0;
            z-index: 100;
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #9e9e9e;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .nav-item.active {
            color: #ff6b35;
        }

        .nav-icon {
            font-size: 20px;
            margin-bottom: 4px;
        }

        /* 加载动画 */
        .loading {
            text-align: center;
            padding: 40px 20px;
        }

        .spinner {
            width: 36px;
            height: 36px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid #ff6b35;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background-color: white;
            border-radius: 16px;
            width: 85%;
            max-width: 320px;
            padding: 24px;
            text-align: center;
            transform: translateY(20px);
            opacity: 0;
            transition: all 0.3s ease;
        }

        .modal.show {
            transform: translateY(0);
            opacity: 1;
        }

        .modal-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 16px;
            color: #333;
        }

        .modal-message {
            margin-bottom: 24px;
            color: #666;
            line-height: 1.6;
        }

        .modal-actions {
            display: flex;
            gap: 12px;
        }

        .modal-btn {
            flex: 1;
            padding: 12px;
            border-radius: 8px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .cancel-btn {
            background-color: #f5f5f5;
            color: #666;
        }

        .confirm-btn {
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
        }

        /* 响应式适配 */
        @media (max-width: 480px) {
            .header-content {
                padding-top: 4px;
            }
            
            .setting-item {
                padding: 16px 16px;
            }
        }

        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .setting-item {
            animation: fadeInUp 0.6s ease forwards;
        }

        /* 按钮状态动画 */
        .switch {
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.02); }
            100% { transform: scale(1); }
        }

        /* 设置项图标样式 */
        .icon-settings { color: #ff6b35; }
        .icon-notification { color: #45b7d1; }
        .icon-security { color: #e91e63; }
        .icon-account { color: #9c27b0; }
        .icon-help { color: #4caf50; }
        .icon-about { color: #ff9800; }

        /* 退出登录按钮 */
        .logout-btn {
            background-color: #ffebee;
            color: #e53935;
            border: none;
            padding: 16px 20px;
            text-align: center;
            width: 100%;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            border-top: 1px solid #eee;
        }

        .logout-btn:hover {
            background-color: #ffcdd2;
            transform: translateY(-2px);
        }

        /* 隐私设置卡片 */
        .privacy-card {
            background-color: #f9f9f9;
            border-radius: 12px;
            padding: 16px;
            margin: 8px 16px;
        }

        .privacy-title {
            font-size: 14px;
            font-weight: bold;
            margin-bottom: 8px;
        }

        .privacy-description {
            font-size: 12px;
            color: #666;
        }

        /* 设置项分组 */
        .settings-group {
            margin-bottom: 20px;
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 头部导航 -->
        <header class="header">
            <div class="header-content">
                <button class="back-btn" id="backBtn">←</button>
                <div class="header-title">设置</div>
                <button class="action-btn" id="saveBtn">保存</button>
            </div>
        </header>

        <!-- 用户信息区域 -->
        <div class="user-info-section">
            <div class="user-avatar">👤</div>
            <div class="user-name">张小明</div>
            <div class="user-id">ID: 123456789</div>
        </div>

        <!-- 设置菜单 -->
        <div class="settings-menu">
            <!-- 账户设置分组 -->
            <div class="settings-group">
                <div class="section-title">账户设置</div>
                
                <!-- 头像设置 -->
                <div class="setting-item" id="avatarSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-account">👤</span>
                        <div class="setting-content">
                            <div class="setting-title">头像设置</div>
                            <div class="setting-description">修改个人头像和昵称</div>
                        </div>
                    </div>
                    <span class="arrow-icon">›</span>
                </div>

                <!-- 昵称设置 -->
                <div class="setting-item" id="nameSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-account">📝</span>
                        <div class="setting-content">
                            <div class="setting-title">昵称设置</div>
                            <div class="setting-description">修改个人昵称和签名</div>
                        </div>
                    </div>
                    <span class="arrow-icon">›</span>
                </div>

                <!-- 手机号绑定 -->
                <div class="setting-item" id="phoneSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-account">📱</span>
                        <div class="setting-content">
                            <div class="setting-title">手机号绑定</div>
                            <div class="setting-description">安全验证和找回密码</div>
                        </div>
                    </div>
                    <span class="setting-value">已绑定</span>
                    <span class="arrow-icon">›</span>
                </div>

                <!-- 邮箱绑定 -->
                <div class="setting-item" id="emailSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-account">✉️</span>
                        <div class="setting-content">
                            <div class="setting-title">邮箱绑定</div>
                            <div class="setting-description">接收重要通知和消息</div>
                        </div>
                    </div>
                    <span class="setting-value">未绑定</span>
                    <span class="arrow-icon">›</span>
                </div>
            </div>

            <!-- 通知设置分组 -->
            <div class="settings-group">
                <div class="section-title">通知设置</div>
                
                <!-- 消息通知 -->
                <div class="setting-item" id="messageNotification">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-notification">🔔</span>
                        <div class="setting-content">
                            <div class="setting-title">消息通知</div>
                            <div class="setting-description">接收活动相关消息提醒</div>
                        </div>
                    </div>
                    <label class="switch">
                        <input type="checkbox" checked>
                        <span class="slider"></span>
                    </label>
                </div>

                <!-- 活动提醒 -->
                <div class="setting-item" id="activityReminder">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-notification">📅</span>
                        <div class="setting-content">
                            <div class="setting-title">活动提醒</div>
                            <div class="setting-description">活动开始前30分钟提醒</div>
                        </div>
                    </div>
                    <label class="switch">
                        <input type="checkbox" checked>
                        <span class="slider"></span>
                    </label>
                </div>

                <!-- 活动推荐 -->
                <div class="setting-item" id="activityRecommendation">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-notification">🎯</span>
                        <div class="setting-content">
                            <div class="setting-title">活动推荐</div>
                            <div class="setting-description">根据兴趣推荐相关活动</div>
                        </div>
                    </div>
                    <label class="switch">
                        <input type="checkbox" checked>
                        <span class="slider"></span>
                    </label>
                </div>

                <!-- 系统通知 -->
                <div class="setting-item" id="systemNotification">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-notification">📢</span>
                        <div class="setting-content">
                            <div class="setting-title">系统通知</div>
                            <div class="setting-description">平台重要更新和公告</div>
                        </div>
                    </div>
                    <label class="switch">
                        <input type="checkbox" checked>
                        <span class="slider"></span>
                    </label>
                </div>
            </div>

            <!-- 隐私设置分组 -->
            <div class="settings-group">
                <div class="section-title">隐私设置</div>
                
                <!-- 隐私卡片 -->
                <div class="privacy-card">
                    <div class="privacy-title">谁可以查看我的活动</div>
                    <div class="privacy-description">设置你的活动对其他人可见的程度</div>
                </div>

                <!-- 隐私设置项 -->
                <div class="setting-item" id="privacySetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-security">🔒</span>
                        <div class="setting-content">
                            <div class="setting-title">隐私设置</div>
                            <div class="setting-description">管理个人资料和活动可见性</div>
                        </div>
                    </div>
                    <span class="arrow-icon">›</span>
                </div>

                <!-- 位置信息 -->
                <div class="setting-item" id="locationSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-security">📍</span>
                        <div class="setting-content">
                            <div class="setting-title">位置信息</div>
                            <div class="setting-description">活动推荐和参与时的位置共享</div>
                        </div>
                    </div>
                    <label class="switch">
                        <input type="checkbox" checked>
                        <span class="slider"></span>
                    </label>
                </div>

                <!-- 朋友圈可见 -->
                <div class="setting-item" id="socialSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-security">👥</span>
                        <div class="setting-content">
                            <div class="setting-title">朋友圈可见</div>
                            <div class="setting-description">活动参与记录是否对好友公开</div>
                        </div>
                    </div>
                    <label class="switch">
                        <input type="checkbox" checked>
                        <span class="slider"></span>
                    </label>
                </div>
            </div>

            <!-- 安全设置分组 -->
            <div class="settings-group">
                <div class="section-title">安全设置</div>
                
                <!-- 密码修改 -->
                <div class="setting-item" id="passwordSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-security">🔑</span>
                        <div class="setting-content">
                            <div class="setting-title">修改密码</div>
                            <div class="setting-description">定期更换密码保障账户安全</div>
                        </div>
                    </div>
                    <span class="arrow-icon">›</span>
                </div>

                <!-- 实名认证 -->
                <div class="setting-item" id="identitySetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-security">🆔</span>
                        <div class="setting-content">
                            <div class="setting-title">实名认证</div>
                            <div class="setting-description">完成实名验证提升账户安全性</div>
                        </div>
                    </div>
                    <span class="setting-value">已认证</span>
                    <span class="arrow-icon">›</span>
                </div>

                <!-- 登录设备管理 -->
                <div class="setting-item" id="deviceSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-security">📱</span>
                        <div class="setting-content">
                            <div class="setting-title">登录设备</div>
                            <div class="setting-description">管理当前和历史登录设备</div>
                        </div>
                    </div>
                    <span class="arrow-icon">›</span>
                </div>
            </div>

            <!-- 帮助与反馈分组 -->
            <div class="settings-group">
                <div class="section-title">帮助与反馈</div>
                
                <!-- 帮助中心 -->
                <div class="setting-item" id="helpSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-help">❓</span>
                        <div class="setting-content">
                            <div class="setting-title">帮助中心</div>
                            <div class="setting-description">常见问题解答和使用指南</div>
                        </div>
                    </div>
                    <span class="arrow-icon">›</span>
                </div>

                <!-- 意见反馈 -->
                <div class="setting-item" id="feedbackSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-help">💬</span>
                        <div class="setting-content">
                            <div class="setting-title">意见反馈</div>
                            <div class="setting-description">告诉我们您的使用体验和建议</div>
                        </div>
                    </div>
                    <span class="arrow-icon">›</span>
                </div>

                <!-- 关于我们 -->
                <div class="setting-item" id="aboutSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-about">ℹ️</span>
                        <div class="setting-content">
                            <div class="setting-title">关于我们</div>
                            <div class="setting-description">了解平台的使命和价值观</div>
                        </div>
                    </div>
                    <span class="arrow-icon">›</span>
                </div>

                <!-- 版本更新 -->
                <div class="setting-item" id="versionSetting">
                    <div style="display: flex; align-items: center;">
                        <span class="setting-icon icon-about">🔄</span>
                        <div class="setting-content">
                            <div class="setting-title">版本更新</div>
                            <div class="setting-description">当前版本 v2.1.5</div>
                        </div>
                    </div>
                    <span class="arrow-icon">›</span>
                </div>
            </div>

            <!-- 退出登录 -->
            <button class="logout-btn" id="logoutBtn">退出当前账号</button>
        </div>

        <!-- 底部导航 -->
        <nav class="bottom-nav">
            <div class="nav-item" data-page="home">
                <span class="nav-icon">🏠</span>
                <span>首页</span>
            </div>
            <div class="nav-item" data-page="search">
                <span class="nav-icon">🔍</span>
                <span>搜索</span>
            </div>
            <div class="nav-item" data-page="publish">
                <span class="nav-icon">➕</span>
                <span>发布</span>
            </div>
            <div class="nav-item active" data-page="profile">
                <span class="nav-icon">👤</span>
                <span>我的</span>
            </div>
        </nav>

        <!-- 退出确认弹窗 -->
        <div class="modal" id="logoutModal">
            <div class="modal-content">
                <h3 class="modal-title">确认退出</h3>
                <p class="modal-message">
                    您确定要退出当前账号吗？<br>
                    退出后需要重新登录才能使用所有功能。
                </p>
                <div class="modal-actions">
                    <button class="modal-btn cancel-btn" id="cancelLogoutBtn">取消</button>
                    <button class="modal-btn confirm-btn" id="confirmLogoutBtn">确认退出</button>
                </div>
            </div>
        </div>

        <!-- 加载状态 -->
        <div class="loading" id="loadingIndicator">
            <div class="spinner"></div>
            <p>加载中...</p>
        </div>

        <!-- 通知 Toast -->
        <div id="toast" style="display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #4caf50; color: white; padding: 12px 24px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1001;"></div>
    </div>

    <script>
        // 全局变量
        let currentSetting = null;
        let settingsData = {
            messageNotification: true,
            activityReminder: true,
            activityRecommendation: true,
            systemNotification: true,
            locationSharing: true,
            socialVisibility: true
        };

        // 初始化
        document.addEventListener('DOMContentLoaded', function() {
            initEventListeners();
            simulateLoading();
            
            // 模拟加载用户数据
            setTimeout(() => {
                updateSettingsDisplay();
            }, 1000);
        });

        // 初始化事件监听器
        function initEventListeners() {
            // 返回按钮
            document.getElementById('backBtn').addEventListener('click', function() {
                window.history.back();
            });

            // 保存按钮
            document.getElementById('saveBtn').addEventListener('click', function() {
                showSuccessToast('设置已保存');
            });

            // 底部导航切换
            const navItems = document.querySelectorAll('.nav-item');
            navItems.forEach(item => {
                item.addEventListener('click', function() {
                    // 移除所有激活状态
                    navItems.forEach(i => i.classList.remove('active'));
                    // 添加当前激活状态
                    this.classList.add('active');
                    
                    const page = this.dataset.page;
                    handleNavigation(page);
                });
            });

            // 设置项点击事件
            const settingItems = document.querySelectorAll('.setting-item');
            settingItems.forEach(item => {
                item.addEventListener('click', function() {
                    const settingId = this.id;
                    handleSettingClick(settingId);
                });
            });

            // 开关切换事件
            const switches = document.querySelectorAll('.switch input');
            switches.forEach(switchEl => {
                switchEl.addEventListener('change', function() {
                    const settingId = this.closest('.setting-item').id;
                    handleSwitchChange(settingId, this.checked);
                });
            });

            // 退出登录按钮
            document.getElementById('logoutBtn').addEventListener('click', function() {
                const modal = document.getElementById('logoutModal');
                modal.classList.add('show');
            });

            // 退出确认弹窗
            document.getElementById('confirmLogoutBtn').addEventListener('click', function() {
                // 模拟退出登录
                showSuccessToast('已成功退出账号');
                closeLogoutModal();
                
                setTimeout(() => {
                    alert('跳转到登录页面...');
                }, 1000);
            });

            // 退出取消弹窗
            document.getElementById('cancelLogoutBtn').addEventListener('click', closeLogoutModal);

            // 退出弹窗背景点击关闭
            document.getElementById('logoutModal').addEventListener('click', function(e) {
                if (e.target === this) {
                    closeLogoutModal();
                }
            });

            // 模拟设置数据更新
            setInterval(() => {
                updateSettingsDisplay();
            }, 60000); // 每分钟更新一次
        }

        // 关闭退出登录弹窗
        function closeLogoutModal() {
            const modal = document.getElementById('logoutModal');
            modal.classList.remove('show');
        }

        // 处理设置项点击
        function handleSettingClick(settingId) {
            switch(settingId) {
                case 'avatarSetting':
                    alert('跳转到头像设置页面');
                    break;
                case 'nameSetting':
                    alert('跳转到昵称设置页面');
                    break;
                case 'phoneSetting':
                    alert('跳转到手机号绑定页面');
                    break;
                case 'emailSetting':
                    alert('跳转到邮箱绑定页面');
                    break;
                case 'privacySetting':
                    alert('跳转到隐私设置页面');
                    break;
                case 'passwordSetting':
                    alert('跳转到密码修改页面');
                    break;
                case 'identitySetting':
                    alert('跳转到实名认证页面');
                    break;
                case 'deviceSetting':
                    alert('跳转到设备管理页面');
                    break;
                case 'helpSetting':
                    alert('跳转到帮助中心页面');
                    break;
                case 'feedbackSetting':
                    alert('跳转到意见反馈页面');
                    break;
                case 'aboutSetting':
                    alert('跳转到关于我们页面');
                    break;
                case 'versionSetting':
                    showSuccessToast('当前已是最新版本');
                    break;
            }
        }

        // 处理开关切换
        function handleSwitchChange(settingId, isChecked) {
            switch(settingId) {
                case 'messageNotification':
                    settingsData.messageNotification = isChecked;
                    break;
                case 'activityReminder':
                    settingsData.activityReminder = isChecked;
                    break;
                case 'activityRecommendation':
                    settingsData.activityRecommendation = isChecked;
                    break;
                case 'systemNotification':
                    settingsData.systemNotification = isChecked;
                    break;
                case 'locationSetting':
                    settingsData.locationSharing = isChecked;
                    break;
                case 'socialSetting':
                    settingsData.socialVisibility = isChecked;
                    break;
            }
            
            // 显示反馈
            const settingTitle = document.getElementById(settingId).querySelector('.setting-title').textContent;
            showSuccessToast(`${settingTitle} ${isChecked ? '已开启' : '已关闭'}`);
        }

        // 更新设置显示状态
        function updateSettingsDisplay() {
            const switches = document.querySelectorAll('.switch input');
            
            switches.forEach(switchEl => {
                const parentItem = switchEl.closest('.setting-item');
                const settingId = parentItem.id;
                
                // 根据数据更新开关状态
                switch(settingId) {
                    case 'messageNotification':
                        switchEl.checked = settingsData.messageNotification;
                        break;
                    case 'activityReminder':
                        switchEl.checked = settingsData.activityReminder;
                        break;
                    case 'activityRecommendation':
                        switchEl.checked = settingsData.activityRecommendation;
                        break;
                    case 'systemNotification':
                        switchEl.checked = settingsData.systemNotification;
                        break;
                    case 'locationSetting':
                        switchEl.checked = settingsData.locationSharing;
                        break;
                    case 'socialSetting':
                        switchEl.checked = settingsData.socialVisibility;
                        break;
                }
            });
        }

        // 处理导航切换
        function handleNavigation(page) {
            switch(page) {
                case 'home':
                    alert('跳转到首页');
                    break;
                case 'search':
                    alert('跳转到搜索页面');
                    break;
                case 'publish':
                    alert('跳转到发布页面');
                    break;
                case 'profile':
                    // 个人中心无需特殊处理
                    break;
            }
        }

        // 显示加载状态
        function showLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'block';
        }

        // 隐藏加载状态
        function hideLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'none';
        }

        // 模拟加载效果
        function simulateLoading() {
            showLoading();
            setTimeout(() => {
                hideLoading();
            }, 1500);
        }

        // 显示成功提示
        function showSuccessToast(message) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.style.display = 'block';
            
            // 3秒后自动隐藏
            setTimeout(() => {
                toast.style.display = 'none';
            }, 3000);
        }

        // 添加触摸反馈效果
        const buttons = document.querySelectorAll('button, .switch');
        buttons.forEach(button => {
            button.addEventListener('touchstart', function() {
                this.style.transform = 'scale(0.95)';
            });
            
            button.addEventListener('touchend', function() {
                this.style.transform = 'scale(1)';
            });
        });

        // 添加页面滚动效果
        let lastScrollTop = 0;
        window.addEventListener('scroll', function() {
            const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
            
            // 隐藏/显示底部导航
            const bottomNav = document.querySelector('.bottom-nav');
            if (scrollTop > lastScrollTop && scrollTop > 100) {
                bottomNav.style.transform = 'translateY(100%)';
            } else {
                bottomNav.style.transform = 'translateY(0)';
            }
            
            lastScrollTop = scrollTop;
        });

        // 添加返回顶部功能
        window.addEventListener('scroll', function() {
            if (window.pageYOffset > 300) {
                // 可以添加返回顶部按钮
            }
        });
    </script>
</body>
</html>
